﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Sasa.QualityTools.CodeAnalysis.Core.Models;
using System.Collections.ObjectModel;

namespace Sasa.QualityTools.CodeAnalysis.FxCopIntegrator.ViewModels.Configurations
{
    public class FilterConfigurationViewModel : ViewModelBase
    {
        private CodeAnalysisConfiguration model;


        public ICollection<FilterPatternViewModel> FilterPatterns { get; private set; }

        public OverrideMode OverrideFilterPatterns
        {
            get
            {
                return model.OverrideFilterPatterns;
            }
            set
            {
                model.OverrideFilterPatterns = value;
                OnPropertyChanged("OverrideFilterPatterns");
            }
        }


        public FilterConfigurationViewModel(CodeAnalysisConfiguration model)
        {
            this.model = model;

            FilterPatterns = new ObservableCollection<FilterPatternViewModel>();
            foreach (var pattern in model.FilterPatterns)
            {
                FilterPatterns.Add(new FilterPatternViewModel { Value = pattern });
            }
        }
    }
}
